import React from 'react'

import './index.scss'
import PropTypes from 'prop-types';
import Router from 'next/router'
import Header from "../header";

export default class TopNavigation extends React.Component{

    constructor(props) {
        super(props);
        this.state = {

        }
    }
    static getDerivedStateFromProps(nextProps){
        let {title} = nextProps
        let info;
        switch (title){
            case 'service':
                info = '产品与服务';
                break;
            case 'case':
                info = '经典案例';
                break;
            case 'about':
                info = '关于我们';
                break;
            case 'news':
                info = '新闻中心';
                break;
            case 'contactGp':
                info = '联系我们';
                break;
            case 'caseDetails':
                info = '经典案例详情';
                break;
            case 'newsDetails':
                info = '新闻详情';
                break;
        }
        return{
            title:info
        }
    }
    render(){
        return(
            <header className='top_navigation'>
                <img className='right_arrow' onClick={() => {
                    Router.back()}} src="/static/aboutImg/back@2x.png" alt=""/>
                <h2 className='con_tit'>{this.state && this.state.title}</h2>
                <img onClick={() => {this.props.changeDisplayNav()}} className='left_menu' src="/static/indexImg/moun.png" alt=""/>
            </header>
        )
    }
}
TopNavigation.propTypes = {
    title: PropTypes.string
}